

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>均衡器模块 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />

  
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script>
        <script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/doctools.js"></script>
        <script src="../../../_static/sphinx_highlight.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../../genindex/" />
    <link rel="search" title="Search" href="../../../search/" />
    <link rel="next" title="CRUSH 图" href="../crush-map/" />
    <link rel="prev" title="Operating the Read (Primary) Balancer" href="../read-balancer/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../../" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="../../">Ceph 存储集群</a></li>
          <li class="breadcrumb-item"><a href="../">集群运维</a></li>
      <li class="breadcrumb-item active">均衡器模块</li>
      <li class="wy-breadcrumbs-aside">
            <a href="../../../_sources/rados/operations/balancer.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../../" class="icon icon-home"> Ceph
          

          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../start/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephadm/">Cephadm</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../">Ceph 存储集群</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../configuration/">配置</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../">运维</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../operating/">操纵集群</a></li>
<li class="toctree-l3"><a class="reference internal" href="../health-checks/">健康检查</a></li>
<li class="toctree-l3"><a class="reference internal" href="../monitoring/">监控集群</a></li>
<li class="toctree-l3"><a class="reference internal" href="../monitoring-osd-pg/">监控 OSD 和归置组</a></li>
<li class="toctree-l3"><a class="reference internal" href="../user-management/">用户管理</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pgcalc/">PG Calc</a></li>
<li class="toctree-l3"><a class="reference internal" href="../data-placement/">数据归置概览</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pools/">存储池</a></li>
<li class="toctree-l3"><a class="reference internal" href="../erasure-code/">纠删码</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cache-tiering/">分级缓存</a></li>
<li class="toctree-l3"><a class="reference internal" href="../placement-groups/">归置组</a></li>
<li class="toctree-l3"><a class="reference internal" href="../upmap/">使用 pg-upmap</a></li>
<li class="toctree-l3"><a class="reference internal" href="../read-balancer/">Operating the Read (Primary) Balancer</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">均衡器模块</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id2">状态</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id3">自动均衡</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id4">抑制</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id5">模式</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id6">受控的优化</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../crush-map/">CRUSH 图</a></li>
<li class="toctree-l3"><a class="reference internal" href="../crush-map-edits/">手动编辑一个 CRUSH 图</a></li>
<li class="toctree-l3"><a class="reference internal" href="../stretch-mode/">Stretch Clusters</a></li>
<li class="toctree-l3"><a class="reference internal" href="../change-mon-elections/">Configuring Monitor Election Strategies</a></li>
<li class="toctree-l3"><a class="reference internal" href="../add-or-rm-osds/">增加/删除 OSD</a></li>
<li class="toctree-l3"><a class="reference internal" href="../add-or-rm-mons/">增加/删除监视器</a></li>
<li class="toctree-l3"><a class="reference internal" href="../devices/">设备管理</a></li>
<li class="toctree-l3"><a class="reference internal" href="../bluestore-migration/">迁移到 BlueStore</a></li>
<li class="toctree-l3"><a class="reference internal" href="../control/">命令参考</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/community/">Ceph 社区</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/troubleshooting-mon/">监视器故障排除</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/troubleshooting-osd/">OSD 故障排除</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/troubleshooting-pg/">归置组排障</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/log-and-debug/">日志记录和调试</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/cpu-profiling/">CPU 剖析</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/memory-profiling/">内存剖析</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../man/">    手册页</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../troubleshooting/">故障排除</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../api/">APIs</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../monitoring/">监控概览</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../hardware-monitoring/">硬件监控</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <section id="balancer">
<span id="id1"></span><h1>均衡器模块<a class="headerlink" href="#balancer" title="Permalink to this heading"></a></h1>
<p>The <em>balancer</em> can optimize the allocation of placement groups (PGs) across
OSDs in order to achieve a balanced distribution. The balancer can operate
either automatically or in a supervised fashion.</p>
<section id="id2">
<h2>状态<a class="headerlink" href="#id2" title="Permalink to this heading"></a></h2>
<p>To check the current status of the balancer, run the following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><style type="text/css">
span.prompt1:before {
  content: "$ ";
}
</style><span class="prompt1">ceph<span class="w"> </span>balancer<span class="w"> </span>status</span>
</pre></div></div></div></blockquote>
</section>
<section id="id3">
<h2>自动均衡<a class="headerlink" href="#id3" title="Permalink to this heading"></a></h2>
<p>When the balancer is in <code class="docutils literal notranslate"><span class="pre">upmap</span></code> mode, which is the default, the automatic
upmap balancing feature is enabled.  For more details, see <a class="reference internal" href="../upmap/#upmap"><span class="std std-ref">使用 pg-upmap</span></a>.
To disable the balancer, run the following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>balancer<span class="w"> </span>off</span>
</pre></div></div></div></blockquote>
<p>The balancer mode can be changed from <code class="docutils literal notranslate"><span class="pre">upmap</span></code> mode to <code class="docutils literal notranslate"><span class="pre">crush-compat</span></code> mode.
<code class="docutils literal notranslate"><span class="pre">crush-compat</span></code> mode is backward compatible with older clients.  In
<code class="docutils literal notranslate"><span class="pre">crush-compat</span></code> mode, the balancer automatically makes small changes to the
data distribution in order to ensure that OSDs are utilized equally.</p>
<p>Additional modes include <code class="docutils literal notranslate"><span class="pre">upmap-read</span></code> and <code class="docutils literal notranslate"><span class="pre">read</span></code>. <code class="docutils literal notranslate"><span class="pre">upmap-read</span></code> mode
combines the upmap balancer with the read balancer so that both writes
and reads are optimized. <code class="docutils literal notranslate"><span class="pre">read</span></code> mode can be used when only read optimization
is desired. For more details, see <a class="reference internal" href="../read-balancer/#read-balancer"><span class="std std-ref">Operating the Read (Primary) Balancer</span></a>.</p>
</section>
<section id="id4">
<h2>抑制<a class="headerlink" href="#id4" title="Permalink to this heading"></a></h2>
<p>If the cluster is degraded (that is, if an OSD has failed and the system hasn’t
healed itself yet), then the balancer will not make any adjustments to the PG
distribution.</p>
<p>When the cluster is healthy, the balancer will incrementally move a small
fraction of unbalanced PGs in order to improve distribution.  This fraction
will not exceed a certain threshold that defaults to 5%. To adjust this
<code class="docutils literal notranslate"><span class="pre">target_max_misplaced_ratio</span></code> threshold setting, run the following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>config<span class="w"> </span><span class="nb">set</span><span class="w"> </span>mgr<span class="w"> </span>target_max_misplaced_ratio<span class="w"> </span>.07<span class="w">   </span><span class="c1"># 7%</span></span>
</pre></div></div></div></blockquote>
<p>The balancer sleeps between runs. To set the number of seconds for this
interval of sleep, run the following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>config<span class="w"> </span><span class="nb">set</span><span class="w"> </span>mgr<span class="w"> </span>mgr/balancer/sleep_interval<span class="w"> </span><span class="m">60</span></span>
</pre></div></div></div></blockquote>
<p>To set the time of day (in HHMM format) at which automatic balancing begins,
run the following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>config<span class="w"> </span><span class="nb">set</span><span class="w"> </span>mgr<span class="w"> </span>mgr/balancer/begin_time<span class="w"> </span><span class="m">0000</span></span>
</pre></div></div></div></blockquote>
<p>To set the time of day (in HHMM format) at which automatic balancing ends, run
the following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>config<span class="w"> </span><span class="nb">set</span><span class="w"> </span>mgr<span class="w"> </span>mgr/balancer/end_time<span class="w"> </span><span class="m">2359</span></span>
</pre></div></div></div></blockquote>
<p>Automatic balancing can be restricted to certain days of the week.  To restrict
it to a specific day of the week or later (as with crontab, <code class="docutils literal notranslate"><span class="pre">0</span></code> is Sunday,
<code class="docutils literal notranslate"><span class="pre">1</span></code> is Monday, and so on), run the following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>config<span class="w"> </span><span class="nb">set</span><span class="w"> </span>mgr<span class="w"> </span>mgr/balancer/begin_weekday<span class="w"> </span><span class="m">0</span></span>
</pre></div></div></div></blockquote>
<p>To restrict automatic balancing to a specific day of the week or earlier
(again, <code class="docutils literal notranslate"><span class="pre">0</span></code> is Sunday, <code class="docutils literal notranslate"><span class="pre">1</span></code> is Monday, and so on), run the following
command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>config<span class="w"> </span><span class="nb">set</span><span class="w"> </span>mgr<span class="w"> </span>mgr/balancer/end_weekday<span class="w"> </span><span class="m">6</span></span>
</pre></div></div></div></blockquote>
<p>Automatic balancing can be restricted to certain pools. By default, the value
of this setting is an empty string, so that all pools are automatically
balanced.  To restrict automatic balancing to specific pools, retrieve their
numeric pool IDs (by running the <strong class="command">ceph osd pool ls detail</strong> command),
and then run the following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>config<span class="w"> </span><span class="nb">set</span><span class="w"> </span>mgr<span class="w"> </span>mgr/balancer/pool_ids<span class="w"> </span><span class="m">1</span>,2,3</span>
</pre></div></div></div></blockquote>
</section>
<section id="id5">
<h2>模式<a class="headerlink" href="#id5" title="Permalink to this heading"></a></h2>
<p>There are currently two supported balancer modes:</p>
<ol class="arabic">
<li><p><strong>crush-compat</strong>. This mode uses the compat weight-set feature (introduced
in Luminous) to manage an alternative set of weights for devices in the
CRUSH hierarchy. When the balancer is operating in this mode, the normal
weights should remain set to the size of the device in order to reflect the
target amount of data intended to be stored on the device. The balancer will
then optimize the weight-set values, adjusting them up or down in small
increments, in order to achieve a distribution that matches the target
distribution as closely as possible. (Because PG placement is a pseudorandom
process, it is subject to a natural amount of variation; optimizing the
weights serves to counteract that natural variation.)</p>
<p>Note that this mode is <em>fully backward compatible</em> with older clients: when
an OSD Map and CRUSH map are shared with older clients, Ceph presents the
optimized weights as the “real” weights.</p>
<p>The primary limitation of this mode is that the balancer cannot handle
multiple CRUSH hierarchies with different placement rules if the subtrees of
the hierarchy share any OSDs. (Such sharing of OSDs is not typical and,
because of the difficulty of managing the space utilization on the shared
OSDs, is generally not recommended.)</p>
</li>
<li><p><strong>upmap</strong>. In Luminous and later releases, the OSDMap can store explicit
mappings for individual OSDs as exceptions to the normal CRUSH placement
calculation. These <code class="docutils literal notranslate"><span class="pre">upmap</span></code> entries provide fine-grained control over the
PG mapping. This balancer mode optimizes the placement of individual PGs in
order to achieve a balanced distribution.  In most cases, the resulting
distribution is nearly perfect: that is, there is an equal number of PGs on
each OSD (±1 PG, since the total number might not divide evenly).</p>
<p>To use <code class="docutils literal notranslate"><span class="pre">upmap</span></code>, all clients must be Luminous or newer.</p>
</li>
<li><p><strong>read</strong>. In Reef and later releases, the OSDMap can store explicit
mappings for individual primary OSDs as exceptions to the normal CRUSH
placement calculation. These <code class="docutils literal notranslate"><span class="pre">pg-upmap-primary</span></code> entries provide fine-grained
control over primary PG mappings. This mode optimizes the placement of individual
primary PGs in order to achieve balanced reads, or primary PGs, in a cluster.
In <code class="docutils literal notranslate"><span class="pre">read</span></code> mode, upmap behavior is not excercised, so this mode is best for
uses cases in which only read balancing is desired.</p>
<p>To use <code class="docutils literal notranslate"><span class="pre">pg-upmap-primary</span></code>, all clients must be Reef or newer. For more
details about client compatibility, see <a class="reference internal" href="../read-balancer/#read-balancer"><span class="std std-ref">Operating the Read (Primary) Balancer</span></a>.</p>
</li>
<li><p><strong>upmap-read</strong>. This balancer mode combines optimization benefits of
both <code class="docutils literal notranslate"><span class="pre">upmap</span></code> and <code class="docutils literal notranslate"><span class="pre">read</span></code> mode. Like in <code class="docutils literal notranslate"><span class="pre">read</span></code> mode, <code class="docutils literal notranslate"><span class="pre">upmap-read</span></code>
makes use of <code class="docutils literal notranslate"><span class="pre">pg-upmap-primary</span></code>. As such, only Reef and later clients
are compatible. For more details about client compatibility, see
<a class="reference internal" href="../read-balancer/#read-balancer"><span class="std std-ref">Operating the Read (Primary) Balancer</span></a>.</p>
<p><code class="docutils literal notranslate"><span class="pre">upmap-read</span></code> is highly recommended for achieving the <code class="docutils literal notranslate"><span class="pre">upmap</span></code> mode’s
offering of balanced PG distribution as well as the <code class="docutils literal notranslate"><span class="pre">read</span></code> mode’s
offering of balanced reads.</p>
</li>
</ol>
<p>The default mode is <code class="docutils literal notranslate"><span class="pre">upmap</span></code>. The mode can be changed to <code class="docutils literal notranslate"><span class="pre">crush-compat</span></code> by running the following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>balancer<span class="w"> </span>mode<span class="w"> </span>crush-compat</span>
</pre></div></div></div></blockquote>
<p>The mode can be changed to <code class="docutils literal notranslate"><span class="pre">read</span></code> by running the following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>balancer<span class="w"> </span>mode<span class="w"> </span><span class="nb">read</span></span>
</pre></div></div></div></blockquote>
<p>The mode can be changed to <code class="docutils literal notranslate"><span class="pre">upmap-read</span></code> by running the following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>balancer<span class="w"> </span>mode<span class="w"> </span>upmap-read</span>
</pre></div></div></div></blockquote>
</section>
<section id="id6">
<h2>受控的优化<a class="headerlink" href="#id6" title="Permalink to this heading"></a></h2>
<p>Supervised use of the balancer can be understood in terms of three distinct
phases:</p>
<ol class="arabic simple">
<li><p>building a plan</p></li>
<li><p>evaluating the quality of the data distribution, either for the current PG
distribution or for the PG distribution that would result after executing a
plan</p></li>
<li><p>executing the plan</p></li>
</ol>
<p>To evaluate the current distribution, run the following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>balancer<span class="w"> </span><span class="nb">eval</span></span>
</pre></div></div></div></blockquote>
<p>To evaluate the distribution for a single pool, run the following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>balancer<span class="w"> </span><span class="nb">eval</span><span class="w"> </span>&lt;pool-name&gt;</span>
</pre></div></div></div></blockquote>
<p>To see the evaluation in greater detail, run the following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>balancer<span class="w"> </span>eval-verbose<span class="w"> </span>...</span>
</pre></div></div></div></blockquote>
<p>To instruct the balancer to generate a plan (using the currently configured
mode), make up a name (any useful identifying string) for the plan, and run the
following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>balancer<span class="w"> </span>optimize<span class="w"> </span>&lt;plan-name&gt;</span>
</pre></div></div></div></blockquote>
<p>To see the contents of a plan, run the following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>balancer<span class="w"> </span>show<span class="w"> </span>&lt;plan-name&gt;</span>
</pre></div></div></div></blockquote>
<p>To display all plans, run the following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>balancer<span class="w"> </span>ls</span>
</pre></div></div></div></blockquote>
<p>To discard an old plan, run the following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>balancer<span class="w"> </span>rm<span class="w"> </span>&lt;plan-name&gt;</span>
</pre></div></div></div></blockquote>
<p>To see currently recorded plans, examine the output of the following status
command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>balancer<span class="w"> </span>status</span>
</pre></div></div></div></blockquote>
<p>To see the status in greater detail, run the following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>balancer<span class="w"> </span>status<span class="w"> </span>detail</span>
</pre></div></div></div></blockquote>
<p>To enable <cite>ceph balancer status detail</cite>, run the following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>config<span class="w"> </span><span class="nb">set</span><span class="w"> </span>mgr<span class="w"> </span>mgr/balancer/update_pg_upmap_activity<span class="w"> </span>True</span>
</pre></div></div></div></blockquote>
<p>To disable <cite>ceph balancer status detail</cite>, run the following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>config<span class="w"> </span><span class="nb">set</span><span class="w"> </span>mgr<span class="w"> </span>mgr/balancer/update_pg_upmap_activity<span class="w"> </span>False</span>
</pre></div></div></div></blockquote>
<p>To evaluate the distribution that would result from executing a specific plan,
run the following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>balancer<span class="w"> </span><span class="nb">eval</span><span class="w"> </span>&lt;plan-name&gt;</span>
</pre></div></div></div></blockquote>
<p>If a plan is expected to improve the distribution (that is, the plan’s score is
lower than the current cluster state’s score), you can execute that plan by
running the following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>balancer<span class="w"> </span>execute<span class="w"> </span>&lt;plan-name&gt;</span>
</pre></div></div></div></blockquote>
</section>
</section>



<div id="support-the-ceph-foundation" class="admonition note">
  <p class="first admonition-title">Brought to you by the Ceph Foundation</p>
  <p class="last">The Ceph Documentation is a community resource funded and hosted by the non-profit <a href="https://ceph.io/en/foundation/">Ceph Foundation</a>. If you would like to support this and our other efforts, please consider <a href="https://ceph.io/en/foundation/join/">joining now</a>.</p>
</div>


           </div>
           
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="../read-balancer/" class="btn btn-neutral float-left" title="Operating the Read (Primary) Balancer" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="../crush-map/" class="btn btn-neutral float-right" title="CRUSH 图" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).</p>
  </div>

   

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>